<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />
<title>尚元优家</title>
<!-- 引入微信的js -->
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script type="text/javascript" src="__PUBLIC__/index/js/jquery-1.8.1.js"></script>
<link href="__PUBLIC__/index/css/enter.css" type="text/css" rel="stylesheet">
<link href="__PUBLIC__/index/css/css.css" type="text/css" rel="stylesheet">

<script type="text/javascript" src="__PUBLIC__/index/js/alert.js"></script>
</head>

<body>
  <div class="login">
            <span><a href="#"><img src="__PUBLIC__/index/image/logo.png" width="100" height="33" /></a></span>
            <div class="login-title"><p><a href="#"><img src="{$img}" style="border-radius:50%;" width="110" height="110"></a></p>
                <i></i>
            </div>
            <form method="post" action="{:U('Enter/enter')}" id="enter">
            <ul>
              <li><i class="un"></i><input class="username" type="text" name="phone" id="phone" required="required" placeholder="请输入你的手机号" /></li>
              <li><i class="pw"></i><input class="pwd" type="password" name="password" id="password" placeholder="请输入密码" /></li>
            </ul>
            <input  type="hidden" name="openid" id="openid" value="{$openid}">
            <div class="login-btn">
                <button type="button" class="submit" onClick="checksubmit();">登&nbsp;录</button>
            </div>
            </form> 
            <div class="quick"><a href="{:U('Register/index')}">立即注册</a>&nbsp;丨&nbsp;<a href="{:U('Forget/index')}">忘记密码?</a></div>
            <div class="chat"><a href="{:U('Enter/login')}"><img src="__PUBLIC__/index/image/weixin.png" width="215" height="80"></a></div>
        </div>
</body>
<style>
	
</style>
</html>
<script type="text/javascript">


wx.config({
    debug: false,
    appId: "{$sign.appId}",
    timestamp:"{$sign.timestamp}",
    nonceStr:"{$sign.nonceStr}",
    signature:"{$sign.signature}",
    jsApiList: [
        'wx.hideOptionMenu',
      ]
});
wx.checkJsApi({
    jsApiList: [
        'getLocation'
    ],
    success: function (res) {
  
        if (res.checkResult.getLocation == false) {
            alert('你的微信版本太低，不支持微信JS接口，请升级到最新的微信版本！');
            return;
        }
    }
});
//隐藏微信右上角
wx.ready(function () {
   wx.hideOptionMenu();
    
});

  function checksubmit(){
    var phone = $('#phone').val();

    var reg = /^0?1[3|4|5|8][0-9]\d{8}$/;
       if(!reg.test(phone)) 
          { 
             hint('请输入有效的手机号码!'); 
             return false; 
         }
    var password=$('#password').val();
    if (password.length<6 || password.length>12) {
        hint("密码不能小于6位或者大于12位");
    };
    var  data={
              phone:phone,
              openid:$("#openid").val(),
              password:password,

            }
    $.post('{:U("Enter/check")}',data,function(obj){
    if (obj.c=="error") {
      hint(obj.m);
      return false;
    };
    
    if (obj.c=="false") {
      hint(obj.m);
      return false;
    };

    if (obj.c=="yes") {
      $('#enter').submit();
    };
  });
  }
</script>